"""
继承的基础语法
单继承

"""
# 单继承
class Phone:
    IMEI = None
    producer = "HM"


    def call_by_4g(self):
        print("使用4G网络打电话")

class Phone2022(Phone):
    face_id = "10001"
    def call_by_5g(self):
        print("使用5G网络打电话")


phone = Phone2022()
print(phone.producer)
phone.call_by_4g()
phone.call_by_5g()
print(phone.IMEI)
print(phone.face_id) #  AttributeError: 'Phone2022'
# 多继承
class NFCReader:
    nfc_version = "1.0"
    producer = "ITHEIMA"
    def read_nfc(self):
        print("读取NFC信息")
    def write_nfc(self):
        print("写入NFC信息")
class RemoteControl:
    remote_version = "1.0"
    producer = "XXX"
    def open_tv(self):
        print("打开电视")
    def close_tv(self):
        print("关闭电视")
# 继承多个父类, 需要注意父类的同名属性和方法, 会优先使用第一个父类的属性和方法
class MyPhone(Phone2022, NFCReader, RemoteControl):
    pass # 占位符, 表示什么都不做
my_phone = MyPhone()
print(my_phone.producer) # HM
my_phone.call_by_4g()
my_phone.call_by_5g()
my_phone.read_nfc()
my_phone.write_nfc()
my_phone.open_tv()
my_phone.close_tv()
